﻿Public Class frmReportCriteria

    Private Sub frmReportCriteria_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadYear()
        LoadTerm()
    End Sub

    ' Display year information
    Private Sub LoadYear()
        With YearComboBox
            '.Items.Add("")
            .Items.Add((DateTime.Today.Year - 4) + 543)
            .Items.Add((DateTime.Today.Year - 3) + 543)
            .Items.Add((DateTime.Today.Year - 2) + 543)
            .Items.Add((DateTime.Today.Year - 1) + 543)
            .Items.Add((DateTime.Today.Year) + 543)
            .Items.Add((DateTime.Today.Year + 1) + 543)
            .Items.Add((DateTime.Today.Year + 2) + 543)
            .Items.Add((DateTime.Today.Year + 3) + 543)
            .Items.Add((DateTime.Today.Year + 4) + 543)
        End With

        YearComboBox.SelectedIndex = 0        
    End Sub

    ' Displays term information
    Private Sub LoadTerm()
        With TermComboBox
            '.Items.Add("")
            .Items.Add(1)
            .Items.Add(2)
            .Items.Add(3)
        End With

        TermComboBox.SelectedIndex = 0
    End Sub

    'Private Sub FillToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    Try
    '        Me.VReport_TransAllTableAdapter.Fill(Me.TransferDataSet.VReport_TransAll, TermToolStripTextBox.Text, YearToolStripTextBox.Text)
    '    Catch ex As System.Exception
    '        System.Windows.Forms.MessageBox.Show(ex.Message)
    '    End Try
    'End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'TODO: This line of code loads data into the 'TransferDataSet.VReport_TransAll' table. You can move, or remove it, as needed.
        'Me.VReport_TransAllTableAdapter.Fill(Me.TransferDataSet.VReport_TransAll,TermComboBox.Text ,YearComboBox.Text )

        If Me.TermComboBox.Text.Length > 0 AndAlso Me.YearComboBox.Text.Length > 0 Then
            Dim nReportType As Integer = 0
            Dim frm As New frmPrintPreviews

            If Me.RadioButton1.Checked Then
                nReportType = 1
            ElseIf Me.RadioButton2.Checked Then
                nReportType = 2
            ElseIf Me.RadioButton3.Checked Then
                nReportType = 3
            End If

            frm.GroupType = "VReport_TransAll"
            frm.Term = Me.TermComboBox.Text
            frm.year = Me.YearComboBox.Text
            frm.ReportOption = nReportType
            frm.ShowDialog()
        End If
    End Sub
End Class